package light3d;
import javax.swing.*;
import java.awt.event.*;


public class EngineWindow extends BufferedCanvas implements KeyListener, WindowListener
{
	private Boolean isKeyPressed[];
	
	public EngineWindow(String title, int w, int h)
	{
		super(title, w, h, 0, 0, 0, 1000);
		addKeyListener(this);
		addWindowListener(this);
		setSize(w,h);
		
		setVisible(true);
		
		isKeyPressed = new Boolean[255];
		for (int i = 0; i < 255; i++)
		{
			isKeyPressed[i] = false;
		}
	}
	public Boolean isPressed(int keyCode)
	{
		return isKeyPressed[keyCode];
	}
	
	/* KeyListener */
	public void keyTyped(KeyEvent e)
	{
	}
	public void keyPressed(KeyEvent e)
	{
		isKeyPressed[e.getKeyCode()] = true;
	}
	public void keyReleased(KeyEvent e)
	{
		isKeyPressed[e.getKeyCode()] = false;
	}
	
	/* WindowListener */
	public void windowActivated(WindowEvent e)
	{
	}
	public void windowClosed(WindowEvent e)
	{
	}
	public void windowClosing(WindowEvent e)
	{
		dispose();
		System.exit(0);
	}
	public void windowDeactivated(WindowEvent e)
	{
	}
	public void windowDeiconified(WindowEvent e)
	{
	}
	public void windowIconified(WindowEvent e)
	{
	}
	public void windowOpened(WindowEvent e)
	{
	}
	
	
}
